package com.netrain.ehp.gateway.handler;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import reactor.core.publisher.Mono;

/**
 * @author gaoliangliang
 * @since 2022/1/14
 */
@RestController
public class IndexHandler {

    private static final String PROD = "product";
    @Value("${spring.profiles.active}")
    private String env;

    @GetMapping("/")
    public Mono<String> index() {
        return Mono.just(desc());
    }

    private String desc() {
        StringBuilder sb = new StringBuilder(100);
        if (!PROD.equals(env)) {
            sb.append("<div><ul><li>文档地址：<a href='doc.html'>doc.html</a></li></ul></div>");
        }
        return sb.toString();
    }
}
